/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __NVRAM_H
#define __NVRAM_H

/* Includes ------------------------------------------------------------------*/
#include "stm32f30x.h"
#include "config.h"

/* Exported types ------------------------------------------------------------*/
typedef struct
{
  uint16_t flash_ok_flag;
  
  // Voltage in volts
  float laser_voltage;
  
  // Voltage in volts
  float apd_voltage;
  
  // Manual setted APD pwm duty value
  uint16_t apd_manual_pwm;
  
  // APD feedback enabled flag
  uint8_t apd_feedback_enabled;
  
  // Comparator threshold voltage, mv
  uint16_t comparator_voltage;
  
} nvram_data_t;

extern nvram_data_t nvram_data;

/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void nvram_use_default_settings(void);
void nvram_save_current_settings(void);
void nvram_read_data(void);

#endif /* __NVRAM_H */
